package pers.cj.pdos.mapper;

import org.apache.ibatis.annotations.Param;
import pers.cj.pdos.entity.Packet;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import pers.cj.pdos.vo.PacketSaleVo;
import pers.cj.pdos.vo.PacketVo;
import pers.cj.pdos.vo.SaleVo;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author chenj
 * @since 2019-11-04
 */
public interface PacketMapper extends BaseMapper<Packet> {

    List<PacketVo> listVoWithStock(@Param("companyId") String companyId,
                                   @Param("page")Integer page,
                                   @Param("limit")Integer limit,
                                   @Param("status")Integer status,
                                   @Param("content")String content,
                                   @Param("houseId")String houseId);

    List<PacketVo> listVo(@Param("companyId") String companyId,
                          @Param("page")Integer page,
                          @Param("limit")Integer limit,
                          @Param("status")Integer status,
                          @Param("content")String content);

    Long count(@Param("companyId")String companyId, @Param("status")Integer status, @Param("content")String genLikeData);

    PacketVo getVoById(@Param("id") String id);

    List<PacketVo> listVoByIds(@Param("ids")List<String> ids);

    /**
     * 根据list列表中的packetId来获取PacketVo列表
     * @param houseId
     * @param list -其中元素还有packetId成员变量
     * @return
     */
    List<PacketVo> listVoByPacketListWithStock(@Param("houseId")String houseId, @Param("list")List list);

    List<Long> check(@Param("id") String id);

    /**
     * 根据套餐id，获取销售和销售退货的数据
     * @param page
     * @param limit
     * @param close
     * @param search
     * @param packetId
     * @param storeId
     * @param userId
     * @param date1
     * @param date2
     * @return
     */
    List<PacketSaleVo> listSaleByPacketId(@Param("page") Integer page,
                                          @Param("limit") Integer limit,
                                          @Param("close") Boolean close,
                                          @Param("search") String search,
                                          @Param("packetId")String packetId,
                                          @Param("storeId") String storeId,
                                          @Param("userId") String userId,
                                          @Param("date1") Date date1,
                                          @Param("date2")Date date2);

    Long countSaleByPacketId(@Param("close") Boolean close,
                             @Param("search") String search,
                             @Param("packetId")String packetId,
                             @Param("storeId") String storeId,
                             @Param("userId") String userId,
                             @Param("date1") Date date1,
                             @Param("date2")Date date2);
}
